// JavaScript Document

/*
 * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/
 * 
 * Copyright (C) 2006 Fernando M.A.d.S. <fermads@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the 
 * GNU Lesser General Public License as published by the Free Software Foundation.
 * 
 * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php
 */

WebKitCp = function(obj) {
	var self = document.createElement('textarea');
	self.id = obj.id + '_iframe';
	self.textarea = obj;
	self.textarea.disabled = true;
	self.textarea.style.overflow = 'hidden';
	self.style.height = self.textarea.style.height;
	self.style.width = self.textarea.style.width;
	self.textarea.style.overflow = 'auto';
	//self.style.border = '1px solid gray';
	//self.frameBorder = 0; // remove IE internal iframe border
	self.style.visibility = 'hidden';
	self.style.position = 'absolute';
	self.options = self.textarea.className;
	
	self.initialize = function() {
		self.setCode(self.textarea.value)
		self.textarea.style.display = 'none';
		self.style.position = 'static';
		self.style.visibility = 'visible';
		self.style.display = 'inline';
		if(typeof window.cp_onload == 'function') window.cp_onload(window);
	}
	
	self.getCode = function() {
		return self.value;
	}

	self.setCode = function(code) {
		self.value = code;
	}
	
	return self;
}
